<template>
  <div class="header">
    <div class="header-left">
      <div class="iconfont back-icon">&#xec73;</div>
    </div>
    <div class="header-input">
      <span class="iconfont">&#xe600;</span>
      输入城市/景点/游玩主题
    </div>
    <router-link to="/city">
    <div class="header-right">
     {{this.city}}
      <span class="iconfont arrow-right">&#xe63b;</span>
    </div>
    </router-link>
  </div>
</template>
<script>
import { mapState } from 'vuex'
export default {
  name: 'HomeHeader',
  computed: {
    ...mapState(['city'])
    // mapState是指把vuex中的数据映射到这个组件的computed计算属性里
    // 把city公用数据映射到一个叫computed计算属性中 以前写的是{{this.$store.state.city}} 现在可以写成 {{this.city}}
  }
}
</script>
<style scoped>
.header {
  display: flex;
  line-height: 0.86rem;
  background: #00bcd4;
  color: #fff;
}
.header-left {
  float: left;
  width: 0.64rem;
  text-align: center;
}
.back-icon{
  font-size: .4rem;
}

.header-input {
  flex: 1;
  height: 0.64rem;
  line-height: 0.64rem;
  margin-top: 0.12rem;
  margin-left: 0.2rem;
  padding-left: 0.2rem;
  color: #ccc;
  background: #fff;
  border-radius: 0.1rem;
}
.header-right {
  min-width: 1.04rem;
  padding: 0 0.1rem;
  float: right;
  text-align: center;
  color: #fff;
}
.arrow-right {
  font-size: 0.07rem;
}
</style>
